Skip to content

fix: enable jcpan -t HTTP::Client::Parallel#592

Closed
fglock wants to merge 1 commit intomasterfrom
fix/jcpan-http-client-parallel
Closed

fix: enable jcpan -t HTTP::Client::Parallel#592
fglock wants to merge 1 commit intomasterfrom
fix/jcpan-http-client-parallel

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented Apr 28, 2026

Summary

Fixes two unrelated issues that blocked jcpan -t HTTP::Client::Parallel.

1. POSIX missing exports

POE::Wheel::Run (loaded transitively from HTTP::Client::Parallel via POE) does:

use POSIX qw(sysconf setsid _SC_OPEN_MAX ECHO ICANON IEXTEN ISIG BRKINT
             ICRNL INPCK ISTRIP IXON CSIZE PARENB OPOST TCSANOW);

The Java side already implemented _const_ECHO, _const_TCSANOW, ... and POSIX.pm wired them into POSIX::ECHO, POSIX::TCSANOW, ..., but those names were missing from @EXPORT_OK, so the import died with "ECHO" is not exported by the POSIX module and the rest of POE failed to compile.

  • Added termios constants and the _SC_* sysconf-name family to @EXPORT_OK.
  • Added a small sysconf() stub that returns sensible defaults (e.g. _SC_OPEN_MAX => 1024).

2. open 0 (one-argument open of a numeric literal)

LWP::Online ships Module::Install::DSL, whose import does open 0 or die ...; $dsl = join "", <0>;. PerlOnJava crashed with:

Modification of a read-only value attempted at ./inc/Module/Install/DSL.pm line 14.

The 1-arg open path in IOOperator.java always called fileHandle.set(...) even when args[0] was a readonly literal scalar, and pulled the filename from $_ instead of from the global scalar of the same name as the filehandle.

Rewrote the 1-arg open block to:

  • Derive the filehandle name from a globref / bareword string / numeric literal.
  • Look up the filename in $main::<name> (so open 0 reads from $0).
  • Register the IO on the named glob.
  • Only write back to args[0] when it is a writable scalar (skip readonly literals).

Test plan

  • make (full unit-test suite) passes.
  • jcpan -t LWP::Online → PASS (8/8 tests).
  • jcpan -t HTTP::Client::Parallel → PASS (live-internet test correctly skipped).

Generated with Devin

Two unrelated issues blocked HTTP::Client::Parallel:

1. POSIX.pm did not export the termios constants nor the _SC_*
   sysconf() name constants used by POE::Wheel::Run (loaded
   transitively from HTTP::Client::Parallel via POE). The Java side
   already implemented _const_ECHO, _const_TCSANOW, etc., and
   POSIX.pm wired them into POSIX::ECHO, POSIX::TCSANOW, ... but
   they were missing from @EXPORT_OK so `use POSIX qw(ECHO ...)` died
   with "ECHO is not exported by the POSIX module". Add the termios
   and _SC_* names to @EXPORT_OK and provide a small sysconf() stub
   that returns sensible defaults (e.g. _SC_OPEN_MAX => 1024).

2. The 1-argument form `open FILEHANDLE` (used by Module::Install::DSL,
   which LWP::Online ships) crashed with "Modification of a read-only
   value" when the filehandle was given as a numeric literal such as
   `open 0`. The runtime tried to call set() on the readonly arg and
   was also picking the filename from $_ instead of from the global
   scalar of the same name as the filehandle. Rewrite the 1-arg open
   path to derive the filehandle name from the value (covering glob
   refs, bareword strings, and numeric literals like 0), look up the
   filename in $main::<name>, and only assign back to args[0] when it
   is a writable scalar.

With both fixes, `jcpan -t HTTP::Client::Parallel` and its
LWP::Online dependency build and pass their unit tests.

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@fglock
Copy link
Copy Markdown
Owner Author

fglock commented Apr 28, 2026

Superseded by #593, which contains both this fix and the op/state.t interpreter fix in a single PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant